package com.shuai.response;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/responseDemo4")
public class ResponseDemo4 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
      //告诉浏览器，服务器发送的消息体数据的编码
//        response.setHeader("content-type","text/html;charset=utf-8");
        //简单的设置编码格式
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().write("你好呀，sdkgjfkhg");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }
}
